<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>新增</title>
<link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/dpl.css" rel="stylesheet">
<link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/bui.css" rel="stylesheet">
<script src="http://g.tbcdn.cn/fi/bui/jquery-1.8.1.min.js"></script>
<script src="http://g.alicdn.com/bui/seajs/2.3.0/sea.js"></script>
<script src="http://g.alicdn.com/bui/bui/1.1.10/config.js"></script>

</head>
<body  style="padding:10px;">
<div class="doc-content" >

  <div class="row" style="padding-right:10px;">
      <div class="span12" style="width:100%;">
        <div class="panel panel-success">
          <div class="panel-header clearfix">
            <h3 class="pull-left">游戏激活码【批量处理】</h3>
            <div class="pull-right">
           		<button class="button button-danger" onClick="javascript:window.location.href='../cdkey/search';" >查询</button>
           </div>
          </div>
          <div class="panel-body">
          
          	        <div class="row">
    				<div class="span8">
     				 	<div id="J_Uploader" />
    				</div> 
    			</div> 
          	
          </div>
        </div>
      </div>

  
 <form id="J_Form" class="form-horizontal" method="post" action="../cdkey/add">
 	<div class="row" style="padding-left:10px;">
        <div class="panel panel-primary">
          <div class="panel-header clearfix">
            <h3 class="pull-left">游戏激活码【单个处理】</h3>
          </div>
          <div class="panel-body">
           
     	    <div class="control-group">
              <label class="control-label">游戏名称：</label>
              <div class="controls">
                <input type="text" class="input-large" name="name">
              </div>
           </div>
            <div class="control-group">
              <label class="control-label">激活码：</label>
              <div class="controls">
                <input type="text" class="input-large" name="codeKey"  onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">
              </div>
           </div>
               <div class="control-group">
              <label class="control-label">可用次数：</label>
              <div class="controls">
                <input type="text" class="input-large" name="size" value="1" onkeyup="this.value=this.value.replace(/\D/g,'')">
              </div>
           </div>
            <div class="control-group">
              <label class="control-label">备注信息：</label>
              <div class="controls  control-row-auto">
                <textarea name="content"  class="control-row4 input-large"></textarea>
              </div>
            </div>
            <div class="row">
              <div class="form-actions offset3">
                <button type="submit" class="button button-primary">保存</button>
                <button type="reset" class="button">重置</button>
              </div>
          </div>  
        </div> 
      </div>
      

  </form>
</div>
  

 
<!-- script start --> 
 <script  type="text/javascript">
  BUI.use('bui/form',function(Form){
          new Form.HForm({
        srcNode : '#J_Form',
        submitType : 'ajax',
        callback : function(data){
          if (data.data)
	        {
	          alert(data.msg);
	          document.getElementById("J_Form").reset()
	        }else
	        {
	          alert(data.msg);
	         }
        }
      }).render();
       });
  
</script>
    <script type="text/javascript">
        BUI.use('bui/uploader',function (Uploader) {
        
      var uploader = new Uploader.Uploader({
        render: '#J_Uploader',
        url: '../cdkey/importExcel',
        //可以直接在这里直接设置成功的回调
        success: function(result){
        window.location.reload(); 
         alert("成功");
        },
        //根据业务需求来判断上传是否成功，这里返回一个boolean
        isSuccess: function(result){
          if(result && result.data){
            return true;
          }
          return false;
        },
        //失败的回调
        error: function(result){
         alert("失败");
        },
         rules: {
          //文的类型
          ext: ['.xls','文件类型只能为{0}'],
          //上传的最大个数
          max: [1, '文件的最大个数不能超过{0}个'],
          //文件大小的最大值,单位也是kb
          maxSize: [1024, '文件大小不能大于1M']
        }
      }).render();
    });
    </script>
</body>
</html>